Method for upgrading firmware of adapter, mobile terminal, and adapter thereof

ABSTRACT

A method of upgrading firmware of an adapter includes transmitting a set of n data blocks of first upgrade file to the adapter, receiving a first response information of the adapter based on the set of n data blocks, and determining that the updating procedure of the adapter fails when the first response information indicates that the adapter fails to receive all of the n data blocks. In the method, a mobile terminal transmits the upgrade file to the adapter and the adapter sends determination information to the mobile terminal after the adapter receives the upgrade file having a predetermined size. In a time interval, if the mobile terminal fails to receive the determination information or the adapter does not receive the upgrade file, the upgrading firmware of the adapter fails.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. application Ser. No.15/306,509, filed Oct. 25, 2016, which is a national phase ofInternational Application No. PCT/CN2015/090626, filed Sep. 24, 2015.The entire disclosures of the above-identified applications areincorporated herein by reference.

BACKGROUND Field

The present disclosure relates to a technical field of communication,and more particularly to a method for upgrading firmware of an adapter,a mobile terminal, and the adapter thereof.

Background

An intelligent adapter is capable of adjusting its operation modeaccording to actual requirements. A main part of an adapter can be amicrocontroller unit (MCU).

A smartphone can download upgrade file for the adapter for upgrading afirmware of the MCU in the adapter via a connection port of thesmartphone. However, data transmission error likely occurs when datatransfers between different components of the smartphone and the adaptervia a long distance, thereby causing failure of upgrading the firmwareof the MCU of the adapter, or even resulting in malfunction of theadapter.

SUMMARY OF THE DISCLOSURE

Based on the above-mentioned drawbacks, one objective of the presentdisclosure is to provide a method for upgrading firmware of an adapter,a mobile terminal, and the adapter thereof to improve accuracy andreliability of a data transmission of the adapter.

In a first aspect of a method for upgrading firmware of an adapter, themethod includes transmitting, by a mobile terminal, a set of n datablocks of a first upgrade file to the adapter, where the first upgradefile is configured to upgrade the firmware of the adapter, and thenumber n is a positive integer either less than or equal to a totalnumber of data blocks of the first upgrade file; receiving, by themobile terminal, a first response information fed back from the adapterresponsive to the data block transmission; and determining, by themobile terminal, that upgrading the firmware of the adapter fails whenthe first response information fed back from the adapter indicates thatthe adapter fails to receive all of the set of n data blocks of thefirst upgrade file.

In at least one embodiment of the first aspect, after transmitting, bythe mobile terminal, the set of n data blocks of the first upgrade fileto the adapter, the method further includes determining, by the mobileterminal, that upgrading the firmware of the adapter fails when themobile terminal does not receive the first response information in afirst preset time interval.

In at least one embodiment of the first aspect, transmitting, by themobile terminal, the set of n data blocks of the first upgrade file tothe adapter includes transmitting, by the mobile terminal, the ith datablock of the set of n data blocks to the adapter, where the number i isa positive integer less than the number n; and the method furtherincludes continuously transmitting, by the mobile terminal, the (i+1)thdata block to the adapter when the mobile terminal receives the firstresponse fed back from the adapter responsive to the ith data blocktransmission, where the first response information is configured toindicate that the adapter receives the ith data block of the firstupgrade file; and determining, by the mobile terminal, that upgradingthe firmware of the adapter fails when the mobile terminal does notreceive the first response information.

In at least one embodiment of the first aspect, when the first responseinformation indicates that the adapter successfully receives all of theset of n data blocks, the method further includes, when the number n isa positive integer less than the total number of data blocks of thefirst upgrade file, continuously transmitting the remaining data blocksof the first upgrade file by the mobile terminal to the adapter; and, ifthe first upgrade file has been sent by the mobile terminal, sending afirst indication information by the mobile terminal to the adapter.

In at least one embodiment of the first aspect, the method furtherincludes sending, by the mobile terminal, a second response informationto the adapter when the mobile terminal receives a set of m data blocksof a second upgrade file which is re-sent by the adapter responsive tothe first indication information in a second preset time interval, wherethe second response information is configured to indicate that themobile terminal has successfully received the set of m data blocks ofthe second upgrade file, and the second upgrade file is the same as theprevious first upgrade file received by the adapter; or sending, by themobile terminal, the second response information to the adapter when themobile terminal determines that upgrading the firmware of the adapterfails in the second preset time interval, where the second responseinformation is configured to indicate that the mobile terminal fails toreceive all of the set of m data blocks of the second upgrade file, andthe number m is a positive integer either less than or equal to a totalnumber of data blocks of the second upgrade file.

In at least one embodiment of the first aspect, the method furtherincludes sending, by the mobile terminal, the second responseinformation to the adapter unless the mobile terminal has not receivedall of the set of m data blocks of the second upgrade file re-sent bythe adapter responsive to the first indication information in the secondpreset time interval.

In at least one embodiment of the first aspect, the number m is equal toone.

In at least one embodiment of the first aspect, the method furtherincludes comparing, by the mobile terminal, the second upgrade file withthe first upgrade file; and sending, by the mobile terminal, the secondindication information to the adapter; where if the second upgrade fileis the same as the first upgrade file, the second indication informationis configured to indicate that upgrading the firmware of the adapter hasbeen completed, and if the second upgrade file differs from the firstupgrade file, the second indication information is configured toindicate that upgrading the firmware of the adapter fails.

In at least one embodiment of the first aspect, before comparing, by themobile terminal, the second upgrade file and the first upgrade file, themethod further includes receiving, by the mobile terminal, a thirdindication information which is sent by the adapter, where the thirdindication information indicates that the adapter has transmitted thesecond upgrade file.

In at least one embodiment of the first aspect, the method furtherincludes re-transmitting, by the mobile terminal, the first upgrade fileto the adapter if the mobile terminal determines that upgrading thefirmware of the adapter fails.

In at least one embodiment of the first aspect, before the mobileterminal transmits the first upgrade file to the adapter, the methodfurther includes receiving, by the mobile terminal, a versioninformation fed back from the adapter; comparing, by the mobileterminal, the version information with a latest version informationprestored in the mobile terminal; when the version information fed backfrom the adapter is lower than the latest version information prestoredin the mobile terminal, the mobile terminal sends an upgradingindication information to the adapter to get ready for receiving thefirst upgrade file.

In a second aspect of a method for upgrading firmware of an adapter, themethod includes receiving, by the adapter, a set of n data blocks of afirst upgrade file transmitted by a mobile terminal, where the firstupgrade file is configured to upgrade the firmware of the adapter, andthe number n is a positive integer either less than or equal to a totalnumber of data blocks of the first upgrade file; and transmitting, bythe adapter, a first response information to the mobile terminalresponsive to receipt of the set of n data blocks, where the firstresponse information indicates that the adapter has successfullyreceived the set of n data blocks.

In at least one embodiment of the second aspect, the method furtherincludes sending, by the adapter, the first response information to themobile terminal, and determining, by the adapter, that upgrading thefirmware of the adapter fails unless the adapter has not received datablocks of the first upgrade file in a first preset time interval.

In at least one embodiment of the second aspect, the method furtherincludes receiving, by the adapter, a first indication information fedback from the mobile terminal, where the first indication informationindicates that the first upgrade file has been sent by the mobileterminal completely; transmitting, by the adapter, a set of m datablocks of second upgrade file to the mobile terminal, where the secondupgrade file is the first upgrade file which is transmitted from themobile terminal to the adapter, and the number m is a positive integereither less than or equal to a total number of data blocks of the secondupgrade file; receiving, by the adapter, a second response informationfed back from the mobile terminal responsive to the transmission of theset of m data blocks; and determining, by the adapter, that upgradingthe firmware of the adapter fails if the second response information fedback from the mobile terminal indicates that the mobile terminal failsto receive all of the set of n data blocks.

In at least one embodiment of the second aspect, the method furtherincludes determining, by the adapter, that upgrading the firmware of theadapter fails when the adapter transmits the set of m data blocks to themobile terminal in a second preset time interval and the adapter failsto receive the second response information.

In at least one embodiment of the second aspect, the second responseinformation indicates that the mobile terminal has successfully receivedthe set of m data blocks, and the method further includes, if the secondupgrade file includes remaining data blocks, continuously transmittingthe remaining data blocks of the second upgrade file by the adapter tothe mobile terminal; and, if the second upgrade file has been completelysent by the adapter, transmitting third indication information by theadapter to the mobile terminal, where the third indication informationindicates that the adapter has completely sent the second upgrade file.

In at least one embodiment of the second aspect, the method furtherincludes receiving, by the adapter, a second indication informationtransmitted by the mobile terminal based on the second upgrade file,where the second indication information indicates that upgrading thefirmware of the adapter either fails or succeeds.

In at least one embodiment of the second aspect, the method furtherincludes, if upgrading the firmware of the adapter fails, cancelling thereceived data blocks of the first upgrade file.

In at least one embodiment of the second aspect, before the adapterreceives the first upgrade file transmitted by the mobile terminal, themethod further includes transmitting, by the adapter, a versioninformation to the mobile terminal, where the version informationindicates a current version of the adapter; and receiving, by theadapter, updating indication information fed back from the mobileterminal, where the updating indication information indicates a need toupgrade firmware of the adapter.

In a third aspect, the mobile terminal includes a transmitting/receivingunit configured to transmit a set of n data blocks of first upgrade fileto an adapter, where the first upgrade file is configured to upgradefirmware of the adapter, and the number n is a positive integer eitherless than or equal to a total number of data blocks of the first upgradefile, where the transmitting/receiving unit includes a processor that iselectrically coupled to the adapter; the transmitting/receiving unitbeing further configured to receive a first response information fedback from the adapter responsive to the data block transmission; and adetermination unit configured to determine that upgrading the firmwareof the adapter fails when the first response information fed back fromthe adapter indicates that the adapter fails to receive all of the setof n data blocks of the first upgrade file.

In at least one embodiment of the third aspect, the determination unitis further configured to determine that upgrading the firmware of theadapter fails when the mobile terminal does not receive the firstresponse information in a first preset time interval after thetransmitting/receiving unit transmits the set of n data blocks of thefirst upgrade file to the adapter.

In at least one embodiment of the third aspect, thetransmitting/receiving unit is configured to transmit the ith data blockof the set of n data blocks to the adapter, where the number i is apositive integer less than the number n; and the transmitting/receivingunit is further configured to continuously transmit the (i+1)th datablock to the adapter when the mobile terminal receives the firstresponse information fed back from the adapter responsive to the ithdata block transmission, where the determination unit determines thatupgrading the firmware of the adapter fails when the determination unitdoes not receive the first response information fed back from theadapter responsive to the ith data block transmission.

In at least one embodiment of the third aspect, when the first responseinformation indicates that the adapter successfully receives all of theset of n data blocks, the transmitting/receiving unit is furtherconfigured to continuously transmit the remaining data blocks of thefirst upgrade file to the adapter if the determination unit determinesthat the first upgrade file includes remaining data blocks; and sendfirst indication information to the adapter if the determination unitdetermines that the first upgrade file has been sent, where the firstindication information indicates that the mobile terminal completelytransmits the first upgrade file.

In at least one embodiment of the third aspect, thetransmitting/receiving unit is configured to either send a secondresponse information to the adapter when a set of m data blocks of asecond upgrade file, which is re-sent by the adapter responsive to thefirst indication information in a second preset time interval, arereceived, where the second response information is configured toindicate that the mobile terminal has successfully received the set of mdata blocks, and the second upgrade file is the same as the previousfirst upgrade file received by the adapter; or send the second responseinformation to the adapter and determine, by the determination unit,that upgrading the firmware of the adapter fails when all of the set ofm data blocks of the second upgrade file which are transmitted by theadapter based on the first indication information in the second presettime interval are not received, where the second response information isconfigured to indicate that the mobile terminal fails to receive all ofthe set of m data blocks, and the number m is a positive integer eitherless than or equal to a total number of data blocks of the secondupgrade file.

In at least one embodiment of the third aspect, thetransmitting/receiving unit is configured to send the second responseinformation to the adapter unless all of the set of m data blocks of thesecond upgrade file re-sent by the adapter responsive to the firstindication information in the second preset time interval has not beenreceived.

In at least one embodiment of the third aspect, the number m is equal toone.

In at least one embodiment of the third aspect, the determination unitis further configured to compare the second upgrade file with the firstupgrade file; and the transmitting/receiving unit is configured to sendthe second indication information to the adapter, where if the secondupgrade file is the same as the first upgrade file, the secondindication information is configured to indicate that upgrading thefirmware of the adapter has been completed, and if the second upgradefile differs from the first upgrade file, the second indicationinformation is configured to indicate that upgrading the firmware of theadapter fails.

In at least one embodiment of the third aspect, before the determinationunit compares the second upgrade file with the first upgrade file, thetransmitting/receiving unit is further configured to receive a thirdindication information which is sent by the adapter, where the thirdindication information indicates that the adapter completely transmitsthe second upgrade file.

In at least one embodiment of the third aspect, thetransmitting/receiving unit is configured to re-transmit the firstupgrade file to the adapter if the determination unit determines thatupgrading the firmware of the adapter fails.

In at least one embodiment of the third aspect, thetransmitting/receiving unit is configured to receive a versioninformation fed back from the adapter before the first upgrade file istransmitted to the adapter; the determination unit is configured tocompare the version information with a latest version information; andwhen the version information fed back from the adapter is lower than thelatest version information prestored in the transmitting/receiving unit,the transmitting/receiving unit sends an upgrading indicationinformation to the adapter to get ready for receiving the first upgradefile.

In a fourth aspect, the adapter includes a transmitting/receiving unitconfigured to receive a set of n data blocks of first upgrade filetransmitted by a mobile terminal, where the first upgrade file isconfigured to upgrade firmware of the adapter, and the number n is apositive integer either less than or equal to a total number of datablocks of the first upgrade file; and the transmitting/receiving unit isfurther configured to transmit a first response information to themobile terminal responsive to receipt of the set of n data blocks, wherethe first response information indicates that the adapter hassuccessfully received the set of n data blocks.

In at least one embodiment of the fourth aspect, the adapter furtherincludes a determination unit configured to send the first responseinformation to the mobile terminal, and determine that upgrading thefirmware of the adapter fails unless the transmitting/receiving unit hasnot received data blocks of the first upgrade file in a first presettime interval.

In at least one embodiment of the fourth aspect, thetransmitting/receiving unit is further configured to receive a firstindication information fed back from the mobile terminal, where thefirst indication information indicates that the first upgrade file hasbeen sent by the mobile terminal completely; transmit a set of m datablocks of second upgrade file to the mobile terminal, where the secondupgrade file is the first upgrade file which is transmitted from themobile terminal to the adapter, and the number m is a positive integereither less than or equal to a total number of data blocks of the secondupgrade file; receive a second response information fed back from themobile terminal responsive to the transmission of the set of m datablocks; and the determination unit is configured to determine thatupgrading the firmware of the adapter fails if the second responseinformation fed back from the mobile terminal indicates that the mobileterminal fails to receive all of the set of n data blocks.

In at least one embodiment of the fourth aspect, the determination unitis configured to determine that upgrading the firmware of the adapterfails when the adapter transmits the set of m data blocks to the mobileterminal in a second preset time interval and the transmitting/receivingunit fails to receive the second response information.

In at least one embodiment of the fourth aspect, the second responseinformation indicates that the mobile terminal has successfully receivedthe set of m data blocks, and the transmitting/receiving unit isconfigured to continuously send remaining data blocks of the secondupgrade file to the mobile terminal if the determination unit determinesthat the second upgrade file includes the remaining data blocks; andtransmit third indication information to the mobile terminal if thedetermination unit determines the second upgrade file has beencompletely sent by the adapter, where the third indication informationindicates that the adapter has completely sent the second upgrade file.

In at least one embodiment of the fourth aspect, thetransmitting/receiving unit is configured to receive a second indicationinformation transmitted by the mobile terminal based on the secondupgrade file, where the second indication information indicates thatupgrading the firmware of the adapter either fails or succeeds.

In at least one embodiment of the fourth aspect, the determination unitis further configured to cancel received data blocks of the firstupgrade file if upgrading the firmware of the adapter fails.

In at least one embodiment of the fourth aspect, thetransmitting/receiving unit is configured to transmit a versioninformation to the mobile terminal before the first upgrade filetransmitted by the mobile terminal is received, where the versioninformation indicates a current version of the adapter; and receiveupgrading indication information fed back from the mobile terminal,where the upgrading indication information indicates a need to upgradefirmware of the adapter.

Based on the above aspects of the method for upgrading firmware of theadapter, mobile terminal, and adapter of the present disclosure, theadapter transmits a response information to the mobile terminal afterthe mobile terminal transmits the upgrade file to the adapter and theadapter receives the upgrade file having the predetermined size. Whenthe adapter does not receive the upgrade file and the mobile terminaldoes not receive the response information, upgrading the firmware of theadapter fails and the mobile terminal re-sends the upgrade file.Moreover, after the mobile terminal transmits the upgrade file to theadapter, the adapter re-transmits the received upgrade file to themobile terminal and the mobile terminal compares the received upgradefile and the transmitted upgrade file to determine whether the upgradefile is correctly transmitted. If the upgrade file is incorrect, themobile terminal re-sends the upgrade file. Therefore, a datatransmission error resulting in malfunction of the adapter can beavoided when performing upgrading the firmware of the adapter such thatthe accuracy and reliability of a data transmission are improved whenthe mobile terminal transmits data to the adapter.

BRIEF DESCRIPTION OF THE DRAWINGS

To describe the technical solutions of the present application moreclearly, the accompanying drawings for illustrating at least oneembodiment will be introduced briefly in the following. Apparently, theaccompanying drawings in the following description are only someembodiments of the present application, and a person of ordinary skillin the art may obtain other drawings based on these accompanyingdrawings without creative efforts.

FIG. 1 is an illustrative flowchart of a method for upgrading firmwareof an adapter according to one embodiment of the present disclosure;

FIG. 2 is an illustrative flowchart of a method for upgrading firmwareof the adapter according to another embodiment of the presentdisclosure;

FIG. 3 is still an illustrative flowchart of a method for upgradingfirmware of the adapter according to another embodiment of the presentdisclosure;

FIG. 4 is an illustrative block diagram of a mobile terminal accordingto one embodiment of the present disclosure;

FIG. 5 is an illustrative block diagram of an adapter according to oneembodiment of the present disclosure; and

FIG. 6 is an illustrative block diagram of an adapter according toanother embodiment of the present disclosure.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

The following embodiments refer to the accompanying drawings forexemplifying specific implementable embodiments of the presentdisclosure. It should be noted that the exemplary described embodimentsare configured to describe and understand the present disclosure, butthe present disclosure is not limited thereto.

FIG. 1 is an illustrative flowchart of a method 100 for upgradingfirmware of the adapter according to one embodiment of the presentdisclosure. A mobile terminal, such as a smartphone, performs the method100. As illustrated in FIG. 1, the method 100 includes the followingblocks.

In block S110, the mobile terminal transmits a set of n data blocks offirst upgrade file to the adapter, where the first upgrade file isconfigured to upgrade firmware of the adapter, and the number n is apositive integer either less than or equal to the total number of datablocks of the first upgrade file.

In block S120, the mobile terminal receives the first responseinformation fed back from the adapter responsive to the data blocktransmission.

In block S130, the mobile terminal determines that upgrading thefirmware of the adapter fails when the first response information fedback from the adapter indicates that the adapter fails to receive all ofthe n data blocks of the first upgrade file.

In detail, the mobile terminal transmits a first upgrade file to theadapter to upgrade firmware of the adapter. When the adapter receivesthe first upgrade file having a predetermined size, for example, whenthe adapter receives the set of n data blocks of first upgrade file, theadapter transmits the first response information to the mobile terminal.When the mobile terminal determines that the adapter has successfullyreceived all of the set of n data blocks responsive to the firstresponse information, the mobile terminal continuously transmitsremaining data blocks of the first upgrade file to the adapter. Theadapter can skip transmitting the first response information to themobile terminal and determine that upgrading the firmware of the adapterfails when the adapter does not receive data blocks of the first upgradefile in a preset time interval, and the adapter can cancel received datablocks of the first upgrade file. The mobile terminal can stoptransmitting the remaining data blocks of the first upgrade file to theadapter and determine that upgrading the firmware of the adapter failswhen the first response information received by the mobile terminalindicates that the adapter does not receive all of the set of n datablocks in a first preset time interval.

Thus, while upgrading the firmware of the adapter, after the mobileterminal transmits the upgrade file to the adapter and the adapterreceives the upgrade file having a predetermined size, the adaptertransmits determination information (e.g., response information) to themobile terminal. When the adapter does not receive the upgrade file andthe mobile terminal does not receive the determination information,upgrading the firmware of the adapter fails and the mobile terminalre-transmits the upgrade file to the adapter so that a data transmissionerror resulting in malfunction of the adapter is avoided when performingupgrading the firmware of the adapter. Therefore, the accuracy andreliability of a data transmission are improved when the mobile terminaltransmits data to the adapter.

It can be understood that, in an embodiment of the present disclosure,the adapter includes an MCU and the MCU can be coupled to an MCU of themobile terminal. For example, the mobile terminal (e.g., a smartphone)downloads data to the adapter via a connection port of the smartphone toupgrade the firmware of the MCU in the adapter.

In block S110, the mobile terminal transmits set of n data blocks offirst upgrade file to the adapter, where the first upgrade file isconfigured to upgrade firmware of the adapter. In at least oneembodiment, the mobile terminal is capable of comparing versioninformation of the adapter to determine whether the adapter should beupgraded or not. If the adapter should be upgraded, the mobile terminaltransmits the upgrade file to the adapter.

In detail, when the adapter makes a communication with the mobileterminal, the adapter transmits the version information indicating acurrent version of adapter to the mobile terminal. The mobile terminalcompares the version information with prestored version information,where the prestored version information is the latest version of theadapter stored in the mobile terminal. If the version information fedback from the adapter is lower than the prestored version information,the mobile terminal transmits updating indication information to theadapter to get ready for receiving the first upgrade file. The adapterprepares to be upgraded on the basis of the updating indicationinformation by receiving the upgrade file transmitted from the mobileterminal.

For example, the version information may be a version number and theadapter transmits a current version number to the mobile terminal, wherethe prestored version information in the mobile terminal is the latestversion number stored in the mobile terminal. If the current versionnumber of adapter is lower than the latest version number, it isrequired to upgrade firmware of the adapter.

In block S120, the mobile terminal receives the first responseinformation responsive to the data block transmission of the set of ndata blocks. In block S130, the mobile terminal determines thatupgrading the firmware of the adapter fails when the first responseinformation indicates that the adapter does not receive all of the setof n data blocks. In detail, the mobile terminal transmits the set of ndata blocks to the adapter. If the adapter receives all of the set of ndata blocks, the adapter transmits the first response information to themobile terminal where the first response information indicates that theadapter has successfully received all of the set of n data blocks. Thus,responsive to the first response information, the mobile terminaldetermines that the mobile terminal has successfully sent the datablocks to the adapter and continuously transmits the rest of datablocks. If the adapter does not receive all of the set of n data blocks,the adapter transmits the first response information to the mobileterminal where the first response information indicates that the adapterdoes not receive all of the set of n data blocks. Therefore, the mobileterminal determines that upgrading the firmware of the adapter fails andstops transmitting the rest of data blocks.

In at least one embodiment, a timer is disposed in the mobile terminal.The mobile terminal determines that upgrading the firmware of theadapter fails since the adapter does not receive the data blocks offirst upgrade file when the mobile terminal does not receive the firstresponse information in a first preset time interval based on the timer.

In at least one embodiment, the mobile terminal transmits a set of ndata blocks to the adapter, where the number n is a positive integereither less than or equal to the number of data blocks of the firstupgrade file. For example, if n is equal to one, the mobile terminaltransmits the set of n data blocks of the first upgrade file one by one.When the mobile terminal receives the first response informationcorresponding to each of data blocks, the mobile terminal continuouslytransmits a next data block. In another example, if n is equal to three,the mobile terminal transmits the set of n data blocks of the firstupgrade file in three data blocks per unit, where the first responseinformation transmitted by the adapter is capable of indicating whetherthe adapter receives the three data blocks per unit. For example, eitherone piece of first response information indicates the reception of threedata blocks or three pieces of first response information indicate thereceptions of three data blocks respectively, but not limited.

In at least one embodiment, the mobile terminal transmits the set of ndata blocks to the adapter, where the number n is a positive integereither less than or equal to the number of data blocks of the firstupgrade file, and a size of each data block can be set according toactual circumstances. For example, one byte or a plurality of bytes canbe defined as the size of each data block. If the size of each datablock is one byte, the mobile terminal waits for the first responseinformation having the one byte from the adapter after transmittingevery one data block having one byte to the adapter. If the mobileterminal receives the first response information in the preset timeinterval, the mobile terminal continuously transmits remaining datablocks to the adapter. If the mobile terminal does not receive the firstresponse information in the preset time interval, the mobile terminaldetermines that upgrading the firmware of the adapter fails and stopstransmitting the data blocks. In another example, if the size of eachdata block is still one byte, the mobile terminal waits for the firstresponse information from the adapter after transmitting a plurality ofdata blocks (i.e., a plurality of bytes) to the adapter. The mobileterminal determines that upgrading the firmware of the adapter failseither if the mobile terminal does not receive the first responseinformation from the adapter or if the mobile terminal receives thefirst response information which indicates that the adapter does notreceive all of the bytes of data blocks. If the mobile terminal receivesthe first response information from the adapter and the first responseinformation received by the mobile terminal indicates that the adapterreceives all of the bytes of data blocks, the mobile terminalcontinuously transmits the remaining data blocks to the adapter.

In at least one embodiment, when the mobile terminal determines thatupgrading the firmware of the adapter fails, the mobile terminal doesnot transmit the first upgrade file to the adapter and the adapter doesnot receive the first upgrade file in the preset time interval so thatthe adapter will exit upgrading the firmware to stop operating upgradingthe firmware at this time. Thus, the adapter waits to receive newupgrade file re-transmitted by the mobile terminal to perform a newupdating procedure. For example, after exiting upgrading the firmware,the adapter can cancel the received first upgrade file which is aportion of all of the upgrade file.

In at least one embodiment, when the mobile terminal determines that theadapter receives a set of n data blocks of first upgrade file, themobile terminal continuously transmits the remaining data blocks offirst upgrade file to the adapter until the mobile terminal transmitsall of the remaining data blocks which means that the mobile terminalcompletely transmits the first upgrade file. In detail, when the mobileterminal continuously transmits data blocks of first upgrade file to theadapter and the mobile terminal receives the first response informationof the adapter, which indicates that the adapter has successfullyreceived the data blocks, the mobile terminal transmits first indicationinformation to the adapter while the mobile terminal completelytransmits the first upgrade file to the adapter, where the firstindication information means that the mobile terminal has completelytransmitted the first upgrade file. If the adapter receives the firstindication information, the adapter transmits second upgrade file to themobile terminal, where the second upgrade file is the received firstupgrade file. The mobile terminal compares the second upgrade file withthe first upgrade file to determine whether the adapter correctlyreceives the upgrade file.

In at least one embodiment, the adapter transmits a set of m data blocksof second upgrade file responsive to first indication information. Themobile terminal transmits second response information to the adapterwhen the mobile terminal receives the set of m data blocks of secondupgrade file, which are transmitted by the adapter, responsive to thefirst indication information in a second preset time interval, where thesecond response information is configured to indicate that the mobileterminal has successfully received the set of m data blocks, and thesecond upgrade file is the same as the previous first upgrade filereceived by the adapter. The mobile terminal transmits the secondresponse information to the adapter and determines that upgrading thefirmware of the adapter fails when the mobile terminal does not receiveall of the set of m data blocks (e.g., only a portion of the set of mdata blocks) of the second upgrade file, which are transmitted by theadapter, responsive to the first indication information in the secondpreset time interval, where the second response information isconfigured to indicate that the mobile terminal fails to receive all ofthe set of m data blocks, and the number m is a positive integer eitherless than or equal to the number of data blocks of the second upgradefile.

In detail, the mobile terminal transmits second response information tothe adapter after the mobile terminal receives the set of m data blocks,where the number m is a positive integer. For example, the mobileterminal transmits one piece of second response information to theadapter after the mobile terminal receives a data block. The mobileterminal does not transmit second response information to the adapter ifthe mobile terminal does not receive the data block in a second presettime interval. In another embodiment, the mobile terminal transmitssecond response information to the adapter after the mobile terminalreceives a plurality of data blocks, where the second responseinformation indicates that the mobile terminal receives the set of mdata blocks. Either one piece of second response information indicatesthat the mobile terminal receives the set of m data blocks or m piece ofsecond response information correspondingly indicates that the mobileterminal receives the set of m data blocks respectively.

In at least one embodiment, the mobile terminal transmits secondresponse information to the adapter after the mobile terminal receivesthe set of m data blocks, where the second response informationindicates that the mobile terminal receives the set of m data blocks. Inone case, if the adapter only transmits the set of m data blocks to themobile terminal, the adapter determines that the mobile terminal hassuccessfully received the set of m data blocks responsive to the secondresponse information and the adapter continuously transmits theremaining data blocks of the second upgrade file. In another case, ifthe adapter transmits the number of data blocks, which is greater thanm, to the mobile terminal, the adapter determines that the mobileterminal only receives the set of m data blocks responsive to the secondresponse information. Thus, since the mobile terminal loses some datablocks, the adapter does not transmit the second upgrade file to themobile terminal again and thus, upgrading the firmware of the adapterfails. Meanwhile, if the mobile terminal does not receive data blocks ina time interval, the mobile terminal determines that upgrading thefirmware of the adapter fails.

In at least one embodiment, the mobile terminal compares the receivedsecond upgrade file with the first upgrade file. In one case, when themobile terminal receives a portion of second upgrade file, the portionof second upgrade file is compared to a portion of first upgrade filecorrespondingly. In another case, when the mobile terminal receives allof the second upgrade file, the all second upgrade file is compared tothe first upgrade file. For example, when the adapter completelytransmits all of the second upgrade file and receives the secondresponse information transmitted by the mobile terminal, the adaptertransmits third indication information to the mobile terminal, where thethird indication information indicates that the adapter completelytransmits all of the second upgrade file.

In at least one embodiment, the mobile terminal compares the secondupgrade file with the first upgrade file and transmits second indicationinformation to the adapter. If the second upgrade file is the same asthe first upgrade file, the mobile terminal determines that upgradingthe firmware of the adapter succeeds responsive to the second indicationinformation. If the second upgrade file is different from the firstupgrade file, the mobile terminal determines that upgrading the firmwareof the adapter fails responsive to the second indication information.When the adapter receives the second indication information, the adapterconfirms that upgrading the firmware fails and cancels the receivedfirst upgrade file (i.e., second upgrade file). The adapter then exitsupgrading the firmware to wait for a next updating procedure. The mobileterminal re-sends new upgrade file to the adapter.

Thus, in upgrading the firmware of the adapter, after the mobileterminal transmits the upgrade file to the adapter and the adapterreceives the upgrade file having the predetermined size, the adaptertransmits response information to the mobile terminal. When the adapterdoes not receive the upgrade file and the mobile terminal does notreceive the response information, upgrading the firmware of the adapterfails and the mobile terminal re-transmits the upgrade file. Moreover,after the mobile terminal transmits the upgrade file to the adapter, theadapter re-transmits the received upgrade file to the mobile terminaland the mobile terminal compares the received upgrade file and thetransmitted upgrade file to determine whether the upgrade file iscorrectly transmitted. If the upgrade file is incorrect, the mobileterminal re-transmits the upgrade file. Therefore, a data transmissionerror resulting in malfunction of the adapter can be avoided whenperforming upgrading the firmware of the adapter such that the accuracyand reliability of a data transmission are improved when the mobileterminal transmits data to the adapter.

FIG. 2 is an illustrative flowchart of a method 200 for upgradingfirmware of the adapter according to another embodiment of the presentdisclosure. The adapter is configured to perform the method 200, wherethe adapter includes an MCU. As illustrated in FIG. 2, the method 200includes the following blocks.

In block S210, the adapter receives a set of n data blocks of firstupgrade file transmitted by a mobile terminal, where the first upgradefile is configured to upgrade firmware of the adapter, and the number nis a positive integer either less than or equal to the number of datablocks of the first upgrade file.

In block S220, the adapter transmits the first response informationresponsive to the set of n data blocks to the mobile terminal, where thefirst response information indicates that the adapter has successfullyreceived the set of n data blocks.

Thus, in upgrading the firmware of the adapter, after the mobileterminal transmits the upgrade file to the adapter and the adapterreceives the upgrade file having a predetermined size, the adaptertransmits determination information to the mobile terminal. When theadapter does not receive the upgrade file and the mobile terminal doesnot receive the determination information, upgrading the firmware of theadapter fails and the mobile terminal re-transmits upgrade file to theadapter so that a data transmission error resulting in malfunction ofthe adapter is avoided when performing upgrading the firmware of theadapter. Therefore, accuracy and reliability of a data transmission areimproved when the mobile terminal transmits data to the adapter.

It can be understood that, in at least one embodiment, the adapterincludes an MCU and the MCU can be coupled to an MCU of the mobileterminal. For example, the mobile terminal (e.g., a smartphone)downloads data to the adapter via a connection port of the smartphone toupgrade the firmware of the MCU in the adapter.

In block S210, the adapter receives the set of n data blocks of thefirst upgrade file transmitted by the mobile terminal, where the firstupgrade file is configured to upgrade firmware of the adapter, and thenumber n is a positive integer either less than or equal to the numberof data blocks of the first upgrade file. In at least one embodiment,when the adapter communicates with the mobile terminal, the adaptertransmits version information to the mobile terminal such that themobile terminal is capable of comparing the version information of theadapter to determine whether the adapter should be upgraded or not. Ifthe adapter should be upgraded, the mobile terminal transmits theupgrade file to the adapter.

In detail, when the adapter makes a communication with the mobileterminal, the adapter transmits the version information indicating acurrent version of adapter, to the mobile terminal. The mobile terminalcompares the version information with prestored version information,where the prestored version information is the latest version of theadapter stored in the mobile terminal. If the version information fedback from the adapter is lower than the prestored version information,the mobile terminal transmits updating indication information toindicate a need to upgrade firmware of the adapter. The adapter preparesto be upgraded on the basis of the updating indication information byreceiving the upgrade file transmitted from the mobile terminal.

For example, the version information may be a version number and theadapter transmits a current version number to the mobile terminal, wherethe prestored version information in the mobile terminal is the latestversion number stored in the mobile terminal. If the current versionnumber of adapter is lower than the latest version number, it isrequired to upgrade firmware of the adapter.

In block S220, the adapter transmits the first response informationresponsive to the set of n data blocks to the mobile terminal, where thefirst response information indicates that the adapter has successfullyreceived the set of n data blocks. In one case, the adapter transmitsone piece of the first response information where the first responseinformation indicates that the adapter has successfully received all ofthe set of n data blocks. In another case, the adapter transmits npieces of the first response information where each piece of the firstresponse information corresponds to one mobile terminal.

In at least one embodiment, the adapter can skip transmitting the firstresponse information to the mobile terminal, and determines thatupgrading the firmware of the adapter fails when the adapter does notreceive data blocks of the first upgrade file in a first preset timeinterval. Furthermore, the mobile terminal also does not transmit datablocks to the adapter continuously and determines that upgrading thefirmware of the adapter fails if the mobile terminal fails to receivefirst response information. For example, if the adapter only receivesthe set of n data blocks in the first preset time interval, the adaptertransmits the first response information to the mobile terminal, wherethe first response information indicates that the adapter merelyreceives the set of n data blocks. Since the mobile terminal transmitsmore data blocks greater than the number n, the adapter does not receiveall of the data blocks from the mobile terminal and the mobile terminaldetermines that upgrading the firmware of the adapter fails and does nottransmit data blocks to the adapter. Similarly, the adapter cannotreceive data blocks in the first preset time interval and determinesupgrading the firmware of the adapter to be failed.

In at least one embodiment, the adapter receives the set of n datablocks of first upgrade file transmitted by a mobile terminal, where thenumber n is a positive integer either less than or equal to the numberof data blocks of the first upgrade file. For example, if n is equal toone, the mobile terminal transmits the set of n data blocks of the firstupgrade file one by one. When the adapter receives one of data blocksand the adapter transmits the first response information correspondingto the one data block to the mobile terminal, the mobile terminalcontinuously transmits a next data block to the adapter. If the adapterdoes not receives a data block from the mobile terminal in the presettime interval, the adapter does not transmits the first responseinformation and determines that upgrading the firmware of the adapterfails. In another example, if n is equal to three, the mobile terminaltransmits the set of n data blocks of the first upgrade file in threedata blocks per unit, where the first response information transmittedby the adapter is capable of indicating whether the adapter receives thethree data blocks per unit. For example, either one piece of firstresponse information indicates the reception of three data blocks orthree pieces of first response information indicate the receptions ofthree data blocks respectively. If the adapter only receives a portionof three data blocks, either the adapter does not transmit the firstresponse information to the mobile terminal or the adapter transmits thefirst response information to the mobile terminal, which indicates thata portion of data blocks are received. Thus, the mobile terminal iscapable of determining that upgrading the firmware of the adapter failsand does not transmit data blocks again.

In at least one embodiment, the mobile terminal transmits the set of ndata blocks to the adapter, where the number n is a positive integereither less than or equal to the number of data blocks of the firstupgrade file, and a size of each data block can be set according toactual circumstances. For example, one byte or a plurality of bytes canbe defined as the size of each data block. If the size of each datablock is one byte, the mobile terminal waits for the first responseinformation having the one byte from the adapter after transmittingevery one data block having one byte to the adapter. If the adapterreceives the data block in the preset time interval, the adaptertransmits the first response information to the mobile terminal and themobile terminal continuously transmits remaining data blocks to theadapter. If the adapter does not receive the data block in the presettime interval, the adapter determines that upgrading the firmware of theadapter fails and does not transmit the first response information tothe mobile terminal. Thus, the mobile terminal determines that upgradingthe firmware of the adapter fails and stops transmitting data blockssince the mobile terminal does not receive the first responseinformation.

In at least one embodiment, if the size of each data block is still onebyte, the mobile terminal waits for the first response information fromthe adapter after transmitting a plurality of data blocks (i.e., aplurality of bytes) to the adapter. Either if the adapter does notreceive the data blocks or receives a portion of data blocks, the mobileterminal determines that upgrading the firmware of the adapter failssince either the mobile terminal does not receive the first responseinformation from the adapter or if the mobile terminal receives thefirst response information which indicates that the adapter does notreceive all of the bytes of data blocks. If the adapter has successfullyreceived all of the data blocks in the preset time interval, the adaptertransmits the first response information to the mobile terminal toindicate that the adapter has successfully received all of the datablocks. The mobile terminal then continuously transmits remaining datablocks to the adapter responsive to the first response information.

In at least one embodiment, when the mobile terminal determines that theadapter receives the set of n data blocks of first upgrade file, themobile terminal continuously transmits the remaining data blocks offirst upgrade file to the adapter until the mobile terminal transmitsall of the remaining data blocks which means that the mobile terminalcompletely transmits the first upgrade file. In detail, when the mobileterminal continuously transmits data blocks of first upgrade file to theadapter and the mobile terminal receives the first response informationof the adapter, which indicates that the adapter has successfullyreceived the data blocks, the mobile terminal transmits first indicationinformation to the adapter while the mobile terminal completelytransmits the first upgrade file to the adapter, where the firstindication information means that the mobile terminal has completelytransmitted the first upgrade file to the adapter. If the adapterreceives the first indication information, the adapter transmits secondupgrade file to the mobile terminal, where the second upgrade file isthe received first upgrade file from the mobile terminal. The mobileterminal compares the second upgrade file with the first upgrade file todetermine whether the adapter correctly receives the upgrade file.

In at least one embodiment, the adapter transmits the set of m datablocks of second upgrade file responsive to first indicationinformation. The mobile terminal transmits second response informationto the adapter based on the received data blocks and the adapterdetermines the adapter continuously transmits the rest of the secondupgrade file to the mobile terminal according to the second responseinformation. In detail, after the adapter transmits the set of m datablocks of second upgrade file to the mobile terminal and if the adapterdoes not receive the second response information in the second presettime interval or if the received second response information indicatesthat the mobile terminal does not receive all of the set of m datablocks, the adapter determines that upgrading the firmware of theadapter fails. The adapter does not transmit the second upgrade file tothe mobile terminal, cancel the received the first upgrade file, andwithdraw upgrading the firmware of the adapter. If the adapter receivesthe second response information which indicates that the mobile terminalreceives all of the set of m data blocks, the adapter continuouslytransmits the remaining data blocks of the second upgrade file until thesecond upgrade file is completely transmitted.

In at least one embodiment, the number m is a positive integer eitherless than or equal to the number of data blocks of the second upgradefile. For example, if m is equal to one, the adapter waits to receivesecond response information when the adapter transmits the set of m datablocks of the second upgrade file one by one. In another example, if mis equal to three, the adapter waits to receive the second responseinformation of the three data blocks when the adapter transmits the setof m data blocks of the second upgrade file in three data blocks perunit. A size of each data block can be set according to actualcircumstances. For example, the size of each data block is set as onebyte, but not limited. If the adapter transmits the second upgrade file,the adapter transmits third indication information to the mobileterminal, where the third indication information indicates that theadapter completely transmits the second upgrade file. The mobileterminal compares the received second upgrade file with the firstupgrade file and transmits second indication information to the adapterresponsive to the comparison result.

In at least one embodiment, if the second indication informationreceived by the adapter indicates a successful updating procedure of theadapter and the second upgrade file is the same as the first upgradefile, the mobile terminal determines that upgrading the firmware of theadapter succeeds responsive to the second indication information.

If the second indication information received by the adapter indicatesthat upgrading the firmware of the adapter fails and the second upgradefile is different from the first upgrade file, the mobile terminaldetermines that upgrading the firmware of the adapter fails responsiveto the second indication information. The adapter then can cancel thereceived first upgrade file and wait to receive upgrade file from themobile terminal.

It should be noted that the above-mentioned embodiments of methods aredepicted in a series of operations with a simplified description.However, it can be understood that, in an embodiment of the presentdisclosure, the operations of the present disclosure are descriptiverather than limiting of the sequence of the operations because someoperations can be sequentially or simultaneously performed on the basisof the functions or logics of operations. it can be understood that, inan embodiment of the present disclosure, the foregoing embodiments aredepicted as preferred embodiments and thus the related operations andunits are not necessarily implements in the present disclosure.

Thus, in upgrading the firmware of the adapter, after the mobileterminal transmits the upgrade file to the adapter and the adapterreceives the upgrade file having the predetermined size, the adaptertransmits response information to the mobile terminal. When the adapterdoes not receive the upgrade file and the mobile terminal does notreceive the response information, upgrading the firmware of the adapterfails and the mobile terminal re-transmits the upgrade file. Moreover,after the mobile terminal transmits the upgrade file to the adapter, theadapter re-transmits the received upgrade file to the mobile terminaland the mobile terminal compares the received upgrade file and thetransmitted upgrade file to determine whether the upgrade file iscorrectly transmitted. If the upgrade file is incorrect, the mobileterminal re-transmits the upgrade file. Therefore, a data transmissionerror resulting in malfunction of the adapter can be avoided whenperforming upgrading the firmware of the adapter such that the accuracyand reliability of a data transmission are improved when the mobileterminal transmits data to the adapter.

By accompanying FIG. 1 with FIG. 2 in the above embodiments, the methodfor upgrading firmware of the adapter based on the mobile terminal andadapter are described. The method for upgrading firmware of the adapterresponsive to the interactions between devices will be introducedbriefly by FIG. 3 in the following.

FIG. 3 is an illustrative flowchart of a method for upgrading firmwareof the adapter according to still another embodiment of the presentdisclosure.

In block S301, the adapter starts to make a communication with a mobileterminal.

In block S302, the adapter transmits version information to the mobileterminal and the mobile terminal compares the version information withprestored version information. For example, the version information maybe a version number and the mobile terminal compares the version numberwith prestored version number. If the version number of the adapter islower than the prestored version number, the mobile terminal determinesthat it is required to upgrade firmware of the adapter and proceed toblock S305. If the version number of the adapter is the same as theprestored version number, the mobile terminal determines that it is notrequired to upgrade firmware of the adapter and proceed to block S303.

In block S303, the mobile terminal identifies the version number of theadapter again to determine whether the adapter needs to be upgraded. Ifit is required to upgrade firmware of the adapter, proceed to blockS302. If it is not required to upgrade firmware of the adapter, proceedto block S304.

In block S304, the mobile terminal waits to communicate with the adapteragain until the adapter is inserted to the mobile terminal and proceedsto block S303.

In block S305, the adapter receives updating indication informationtransmitted by the mobile terminal for preparing upgrading the firmwareof the adapter. In other words, the adapter prepares to receive theupgrade file transmitted from the mobile terminal.

In block S306, the adapter receives first upgrade file transmitted bythe mobile terminal, where the first upgrade file is configured toupgrade firmware of the adapter. For example, after the adapter receivesdata block having one byte, the adapter is capable of transmitting firstresponse information to the mobile terminal. If the adapter does notreceive the data blocks of the first upgrade file transmitted by mobileterminal in a preset time interval, proceed to block S307. If theadapter receives the data blocks having one byte, proceed to block S308.

In block S307, if upgrading the firmware of the adapter fails, themobile terminal and adapter exits an updating mode. The adapter cancancel the received first upgrade file and proceed to block S303.

In block S308, the adapter transmits the first response information tothe mobile terminal, where the first response information indicates thatthe adapter has successfully received the data block having one byte. Ifthe mobile terminal receives the first response information in thepreset time interval, proceed to block S309. If the mobile terminal doesnot receive the first response information in the preset time interval,proceed to block S307.

In block S309, after the mobile terminal receives the first responseinformation, the mobile terminal determines whether the mobile terminalcompletely transmits the first upgrade file. If the mobile terminal doesnot completely transmit the first upgrade file, the mobile terminalcontinuously transmits the first upgrade file and proceeds block S306.If the mobile terminal determines that the first upgrade file have noremaining data, the mobile terminal completely transmits the firstupgrade file and proceeds to block S310.

In block S310, the mobile terminal transmits first indicationinformation to the adapter, where the first indication informationcompletely transmits the first upgrade file to adapter so that theadapter returns the received first upgrade file to the mobile terminalresponsive to the first indication information.

In block S311, the mobile terminal receives second upgrade filetransmitted by the adapter, where the second upgrade file is thereceived first upgrade file. In at least one embodiment, the process oftransmitting the second upgrade file from the adapter to the mobileterminal is similar to the process of transmitting the first upgradefile from the mobile terminal to the adapter. In detail, when the mobileterminal receives each data block having one byte, the mobile terminaltransmits second response information to the adapter. After the adapterreceives the second response information, the adapter continuouslytransmits second upgrade file to the mobile terminal until the secondupgrade file is transmitted completely. The adapter then transmitssecond indication information to the mobile terminal and proceeds toblock S312, where the second indication information indicates that theadapter completely transmits the second upgrade file to the mobileterminal completely. If the mobile terminal does not receive the secondupgrade file in the preset time interval, the mobile terminal does nottransmit second response information to the adapter. When the adapterdoes not receive the second response information, the adapter can stoptransmitting the second upgrade file and upgrading the firmware of theadapter fails before proceeding to block S307.

In block S312, after the mobile terminal receives the second upgradefile completely, the mobile terminal compares the second upgrade filewith the first upgrade file and the mobile terminal transmits thirdindication information to the adapter responsive to the compared result.If the second upgrade file is the same as the first upgrade file, blockS314 is performed. If the second upgrade file is different from thefirst upgrade file, proceed to block S313.

In block S313, if the mobile terminal transmits the third indicationinformation to adapter where the third indication information indicatesthat upgrading the firmware of the adapter fails, upgrading the firmwareof the adapter is repeated again.

In block S314, if the mobile terminal transmits the third indicationinformation to adapter where the third indication information indicatesthat upgrading the firmware of the adapter succeeds, upgrading thefirmware of the adapter is complete.

It should be noted that the above-mentioned embodiments of methods aredepicted in a series of operations with a simplified description.However, it can be understood that, in an embodiment of the presentdisclosure, the operations of the present disclosure are descriptiverather than limiting of the sequence of the operations because someoperations can be sequentially or simultaneously performed on the basisof the functions or logics of operations. It can be understood that, inan embodiment of the present disclosure, the foregoing embodiments aredepicted as preferred embodiments and thus the related operations andunits are not necessarily implements in the present disclosure.

Thus, in upgrading the firmware of the adapter, after the mobileterminal transmits the upgrade file to the adapter and the adapterreceives the upgrade file having the predetermined size, the adaptertransmits response information to the mobile terminal. When the adapterdoes not receive the upgrade file and the mobile terminal does notreceive the response information, upgrading the firmware of the adapterfails and the mobile terminal re-transmits the upgrade file. Moreover,after the mobile terminal transmits the upgrade file to the adapter, theadapter re-transmits the received upgrade file to the mobile terminaland the mobile terminal compares the received upgrade file and thetransmitted upgrade file to determine whether the upgrade file iscorrectly transmitted. If the upgrade file is incorrect, the mobileterminal re-transmits the upgrade file. Therefore, a data transmissionerror resulting in malfunction of the adapter can be avoided whenperforming upgrading the firmware of the adapter such that the accuracyand reliability of a data transmission are improved when the mobileterminal transmits data to the adapter.

By accompanying FIG. 1 through FIG. 3 in the above embodiments, themethod for upgrading firmware of the adapter based on the mobileterminal and adapter are described. The device for upgrading firmware ofthe adapter in accordance with embodiments of the present disclosurewill be briefly introduced by FIGS. 4 through 6 in the following.

As illustrated in FIG. 4, the mobile terminal 400 in at least oneembodiment includes a transmitting/receiving unit 410 configured totransmit the set of n data blocks of first upgrade file to an adapter,where the first upgrade file is configured to upgrade firmware of theadapter, and the number n is a positive integer either less than orequal to the number of data blocks of the first upgrade file; thetransmitting/receiving unit 410 is configured to receive first responseinformation which is transmitted by the adapter based on the set of ndata blocks; and a determination unit (e.g., a processor) 420 configuredto determine that upgrading the firmware of the adapter fails when thefirst response information indicates that the adapter does not receiveall of the set of n data blocks.

Thus, the mobile terminal of the present disclosure transmits theupgrade file to the adapter and the adapter sends determinationinformation to the mobile terminal after the adapter receives theupgrade file having a predetermined size. If the mobile terminal doesnot receive the determination information or the adapter does notreceive the upgrade file, upgrading the firmware fails. Therefore, adata transmission error resulting in malfunction of the adapter can beavoided when performing upgrading the firmware of the adapter such thatthe accuracy and reliability of a data transmission are improved whenthe mobile terminal transmits data to the adapter.

In at least one embodiment, after the transmitting/receiving unit 410transmits the set of n data blocks of the first upgrade file to theadapter in a first preset time interval, the determination unit 420 isconfigured to determine that upgrading the firmware of the adapter failswhen the mobile terminal does not receive the first responseinformation.

In at least one embodiment, the transmitting/receiving unit 410 isconfigured to transmit the ith data block of the set of n data blocks tothe adapter, where the number i is a positive integer less than thenumber n, and the transmitting/receiving unit 410 is further configuredto continuously transmit the (i+1)th data block to the adapter when themobile terminal receives the first response information which istransmitted by the adapter responsive to the ith data block, where thedetermination unit 420 determines that upgrading the firmware of theadapter fails responsive to the first response information when thedetermination unit 410 does not receive the first response informationwhich is transmitted by the adapter responsive to the ith data block.

In at least one embodiment, when the first response informationindicates that the adapter has successfully received all of the set of ndata blocks, the transmitting/receiving unit 410 is further configuredto continuously transmit remaining data blocks of the first upgrade fileto the adapter if the determination unit 420 determines that the firstupgrade file includes the remaining data blocks, and to transmit firstindication information to the adapter if the determination unit 420determines that the first upgrade file is completely transmitted, wherethe first indication information indicates that the mobile terminalcompletely transmits the first upgrade file.

In at least one embodiment, the transmitting/receiving unit 410 isconfigured to either transmit second response information to the adapterwhen the set of m data blocks of second upgrade file, which aretransmitted by the adapter responsive to the first indicationinformation in a second preset time interval, are received, where thesecond response information is configured to indicate that the mobileterminal has successfully received the set of m data blocks, and thesecond upgrade file is the same as the previous first upgrade filereceived by the adapter, or to transmit the second response informationto the adapter and determine, by the determination unit 420, thatupgrading the firmware of the adapter fails when all of the set of mdata blocks of the second upgrade file which are transmitted by theadapter responsive to the first indication information in the secondpreset time interval are not received, where the second responseinformation is configured to indicate that the mobile terminal fails toreceive all of the set of m data blocks, and the number m is a positiveinteger either less than or equal to the number of data blocks of thesecond upgrade file.

In at least one embodiment, the transmitting/receiving unit 410 isconfigured to skip transmitting the second response information to theadapter when all of the set of m data blocks of the second upgrade file,which are transmitted by the adapter responsive to the first indicationinformation in the second preset time interval, are not received.

In at least one embodiment, a value of m is equal to one.

In at least one embodiment, the determination unit 420 is furtherconfigured to compare the second upgrade file with the first upgradefile, and the transmitting/receiving unit 410 is configured to transmitthe second indication information to the adapter, where if the secondupgrade file is the same as the first upgrade file, the secondindication information is configured to indicate upgrading the firmwareof the adapter to be complete, and if the second upgrade file isdifferent from the first upgrade file, the second indication informationis configured to indicate upgrading the firmware of the adapter to beincomplete.

In at least one embodiment, before the determination unit 420 comparesthe second upgrade file with the first upgrade file, thetransmitting/receiving unit 410 is configured to receive a thirdindication information which is transmitted by the adapter, where thethird indication information indicates that the adapter completelytransmits the second upgrade file.

In at least one embodiment, the transmitting/receiving unit 410 isconfigured to re-transmit the first upgrade file to the adapter if thedetermination unit 420 determines that upgrading the firmware of theadapter fails.

In at least one embodiment, the transmitting/receiving unit 410 isconfigured to receive version information fed back from the adapterbefore the first upgrade file is transmitted to the adapter, and thedetermination unit 420 is configured to compare the version informationwith prestored version information, where if the version information fedback from the adapter is lower than the prestored version informationstored in the transmitting/receiving unit 420, thetransmitting/receiving unit 420 transmits an updating indicationinformation to indicate a need to upgrade firmware of the adapter.

It should be noted that the mobile terminal 400 is capable of performingthe method 100 correspondingly in the present disclosure. Furthermore,the operations and/or functions described in the units of the mobileterminal 400 correspond to the blocks depicted in FIG. 1. For the sakeof brevity, it will not be repeated here.

Thus, in the mobile terminal of the present disclosure, after the mobileterminal transmits the upgrade file to the adapter and the adapterreceives the upgrade file having the predetermined size, the adaptertransmits response information to the mobile terminal. When the adapterdoes not receive the upgrade file and the mobile terminal does notreceive the response information, upgrading the firmware of the adapterfails and the mobile terminal re-transmits the upgrade file. Moreover,after the mobile terminal transmits the upgrade file to the adapter, theadapter re-transmits the received upgrade file to the mobile terminaland the mobile terminal compares the received upgrade file and thetransmitted upgrade file to determine whether the upgrade file iscorrectly transmitted. If the upgrade file is incorrect, the mobileterminal re-transmits the upgrade file. Therefore, a data transmissionerror resulting in malfunction of the adapter can be avoided whenperforming upgrading the firmware of the adapter such that the accuracyand reliability of a data transmission are improved when the mobileterminal transmits data to the adapter.

As illustrated in FIG. 5, the adapter 500 in at least one embodimentincludes a transmitting/receiving unit 510 is configured to receive aset of n data blocks of first upgrade file transmitted by a mobileterminal, where the first upgrade file is configured to upgrade firmwareof the adapter, and the number n is a positive integer either less thanor equal to the number of data blocks of the first upgrade file; and thetransmitting/receiving unit 510 is further configured to transmit firstresponse information based on the set of n data blocks to the mobileterminal, where the first response information indicates that theadapter has successfully received the set of n data blocks.

Thus, the adapter receives the upgrade file transmitted by the mobileterminal and the adapter sends determination information to the mobileterminal after the adapter receives the upgrade file having apredetermined size. If the mobile terminal does not receive thedetermination information or the adapter does not receive the upgradefile, upgrading the firmware fails. Therefore, a data transmission errorresulting in malfunction of the adapter can be avoided when performingupgrading the firmware of the adapter such that the accuracy andreliability of a data transmission are improved when the mobile terminaltransmits data to the adapter.

In at least one embodiment of FIG. 6, the adapter further includes adetermination unit 520 configured to skip transmitting the firstresponse information to the mobile terminal, and determine thatupgrading the firmware of the adapter fails when thetransmitting/receiving unit 510 does not receive data blocks of thefirst upgrade file in a first preset time interval.

In at least one embodiment, the transmitting/receiving unit 510 isfurther configured to receive first indication information which istransmitted by the mobile terminal, where the first indicationinformation indicates that the mobile terminal completely transmits thefirst upgrade file, to transmit the set of m data blocks of secondupgrade file to the mobile terminal, where the second upgrade file isthe first upgrade file which is transmitted from the mobile terminal tothe adapter, and the number m is a positive integer either less than orequal to the number of data blocks of the second upgrade file, and toreceive second response information which is transmitted by the mobileterminal based on the set of m data blocks, and the determination unit520 is configured to determine that upgrading the firmware of theadapter fails if the second response information indicates that themobile terminal does not receive all of the set of n data blocks.

In at least one embodiment, the determination unit 520 is configured todetermine that upgrading the firmware of the adapter fails when theadapter transmits the set of m data blocks to the mobile terminal in asecond preset time interval and the transmitting/receiving unit 510 doesnot receive the second response information.

In at least one embodiment, the second response information indicatesthat the mobile terminal has successfully received the set of m datablocks, and the transmitting/receiving unit 510 is configured tocontinuously transmit remaining data blocks of the second upgrade fileto the mobile terminal if the determination unit 520 determines thesecond upgrade file includes the remaining data blocks; and transmitthird indication information to the mobile terminal if the determinationunit 520 determines that the second upgrade file is completelytransmitted, where the third indication information indicates that theadapter completely transmits the second upgrade file.

In at least one embodiment, the transmitting/receiving unit 510 isconfigured to receive second indication information transmitted by themobile terminal based on the second upgrade file, where the secondindication information indicates that upgrading the firmware of theadapter either fails or succeeds.

In at least one embodiment, the determination unit 520 is configured tocancel received data blocks of the first upgrade file if upgrading thefirmware of the adapter fails.

In at least one embodiment, the transmitting/receiving unit 510 isconfigured to transmit version information to the mobile terminal beforethe first upgrade file transmitted by the mobile terminal is received,where the version information indicates a current version of theadapter, and to receive updating indication information transmitted bythe mobile terminal, where the updating indication information indicatesa need to upgrade firmware of the adapter.

It should be noted that the adapter 500 is capable of performing themethod 200 correspondingly in the present disclosure. Furthermore, theoperations and/or functions described in the units of the adapter 500correspond to the blocks depicted in FIG. 2. For the sake of brevity, itwill not be repeated here.

Thus, in the adapter of the present disclosure, after the adapterreceives the upgrade file transmitted by the mobile terminal and theadapter receives the upgrade file having a predetermined size, theadapter transmits response information to the mobile terminal. When theadapter does not receive the upgrade file in a preset time interval andthe mobile terminal does not receive the response information, upgradingthe firmware of the adapter fails and the mobile terminal re-transmitsthe upgrade file. Moreover, after the mobile terminal transmits theupgrade file to the adapter, the adapter re-transmits the receivedupgrade file to the mobile terminal and the mobile terminal compares thereceived upgrade file and the transmitted upgrade file to determinewhether the upgrade file is correctly transmitted. If the upgrade fileis incorrect, the mobile terminal re-transmits the upgrade file.Therefore, a data transmission error resulting in malfunction of theadapter can be avoided when performing upgrading the firmware of theadapter such that the accuracy and reliability of a data transmissionare improved when the mobile terminal transmits data to the adapter.

It can be understood that, in an embodiment of the present disclosure,the units and methods of the present disclosure can be implemented byelectronic hardware, computing software and the combination thereof bbased on conditions of application and design fields. Some embodimentsof the present disclosure further provide a computer storage media whichstores programs to implement all or partial blocks of the methodsdescribed in some embodiments of the disclosure. Illustratively, theabove-mentioned embodiments of methods are depicted in a series ofoperations with a simplified description. However, it can be understoodthat, in an embodiment of the present disclosure, the operations of thepresent disclosure are descriptive rather than limiting of the sequenceof the operations because some operations can be sequentially orsimultaneously performed. It can be understood that, in an embodiment ofthe present disclosure, the foregoing embodiments are depicted aspreferred embodiments and thus the related operations and units are notnecessarily implements in the present disclosure.

It can be understood that, in an embodiment of the present disclosure,the implement of above-mentioned system, devices and units can bereferred to the methods correspondingly. For the sake of brevity andconvenience, it will not be repeated here.

In some embodiments of the present disclosure, it should be noted thatthe described devices can be implemented by different components. Forexample, some embodiments of above-described devices are illustratedwhere the unit division is based on logical function and whileimplementing at least one embodiment, the unit division is basis ondifferent ways. For example, a plurality of units or members can becombined together or integrated to another system, or some features maybe ignore or are not performed. Furthermore, the above-describedcoupling, direct couple or communication connection statuses betweeninteractions are implemented by interfaces. The indirect coupling orcommunication connection between devices or units is in electrical,mechanical or other statuses.

The separation of components is or is not a physically independentstatus. The display unit can be or is not a physical unit. In otherwords, the display unit may be disposed one place or arranged in networkunits. Based on requirement, a portion of units or all of the units areconfigured to implement the technical schemes of the present disclosure.

Moreover, functional units in some embodiments of the present disclosureare integrated to a processing unit or each functional unit is installedindependently.

If the above-mentioned integrated units are implemented by softwarefunctional components and serve as independent products for sale orusage, the integrated units are stored in computer readable storagemedia. Based on the descriptions of embodiments, it can be understoodthat, in an embodiment of the present disclosure, all or partial of thetechnical schemes of the present disclosure can be performed by softwareproducts, hardware products, firmware products and the combinations. Thesoftware products of a computer are stored in storage media and includea plurality of instructions to allow at least one computing device toexecute all or partial functions of the method where the computingdevice is selected from a group including a personal computer, a serverand network device. For example, the storage media are selected from USBdisk, portable hard disk drive, Random Access Memory (RAM), Read-OnlyMemory (ROM), Electrically Erasable Programmable Read-Only Memory(EEPROM), Compact Disc Read-Only Memory (CD-ROM) or other kinds of discstorages, magnetic storage media or other magnetic storage device, andmedia of which program codes with portable stored instructions or datacan be accessed by the computer to execute at least one applicationprogram for performing above-mentioned method.

As is understood by persons skilled in the art, the foregoing preferredembodiments of the present disclosure are illustrative rather thanlimiting of the present disclosure. It is intended that they covervarious modifications and similar arrangements be included in the spiritand scope of the present disclosure, the scope of which should beaccorded the broadest interpretation so as to encompass all suchmodifications and similar structures.

What is claimed is:
 1. A method for upgrading firmware of an adapter,comprising: receiving, by the adapter, a set of n data blocks of a firstupgrade file transmitted by a mobile terminal, wherein the first upgradefile is configured to upgrade the firmware of the adapter, and thenumber n is a positive integer either less than or equal to a totalnumber of data blocks of the first upgrade file; and transmitting, bythe adapter, first response information to the mobile terminalresponsive to receipt of the set of n data blocks, wherein the firstresponse information indicates whether the adapter has successfullyreceived the set of n data blocks.
 2. The method of claim 1, furthercomprising: determining, by the adapter, that upgrading the firmware ofthe adapter fails when the adapter has not received data blocks of thefirst upgrade file in a first preset time interval.
 3. The method ofclaim 1, wherein transmitting the first response information to themobile terminal responsive to receipt of the set of n data blockscomprises: when the adapter receives the ith data block of the set of ndata blocks from the mobile terminal, transmitting, by the adapter, thefirst response information indicating that the adapter receives the ithdata block of the first upgrade file to the mobile terminal, wherein thenumber i is a positive integer less than the number n.
 4. The method ofclaim 1, further comprising: receiving, by the adapter, first indicationinformation fed back from the mobile terminal, wherein the firstindication information indicates that the first upgrade file has beensent by the mobile terminal completely; transmitting, by the adapter, aset of m data blocks of second upgrade file to the mobile terminal,wherein the second upgrade file is the first upgrade file which istransmitted from the mobile terminal to the adapter, and the number m isa positive integer either less than or equal to a total number of datablocks of the second upgrade file; receiving, by the adapter, secondresponse information fed back from the mobile terminal responsive to thetransmission of the set of m data blocks; and determining, by theadapter, that upgrading the firmware of the adapter fails if the secondresponse information fed back from the mobile terminal indicates thatthe mobile terminal fails to receive all of the set of n data blocks. 5.The method of claim 4, further comprising: determining, by the adapter,that upgrading the firmware of the adapter fails when the adaptertransmits the set of m data blocks to the mobile terminal in a secondpreset time interval and the adapter fails to receive the secondresponse information.
 6. The method of claim 4, wherein the secondresponse information indicates that the mobile terminal has successfullyreceived the set of m data blocks, and the method further comprises:when the second upgrade file comprises remaining data blocks,continuously sending the remaining data blocks of the second upgradefile by the adapter to the mobile terminal; and when the second upgradefile has been completely sent by the adapter, transmitting secondindication information by the adapter to the mobile terminal, whereinthe second indication information indicates that the adapter hascompletely sent the second upgrade file.
 7. The method of claim 4,further comprising: receiving, by the adapter, third indicationinformation transmitted by the mobile terminal based on a comparison ofthe first upgrade file and the second upgrade file, wherein the thirdindication information indicates that upgrading the firmware of theadapter either fails or succeeds.
 8. The method of claim 1, furthercomprising: when upgrading the firmware of the adapter fails, cancellingthe received data blocks of the first upgrade file.
 9. The method ofclaim 1, further comprising: transmitting, by the adapter, versioninformation to the mobile terminal, wherein the version informationindicates a current version of the adapter; and receiving, by theadapter, upgrading indication information fed back from the mobileterminal, wherein the upgrading indication information indicates a needto upgrade firmware of the adapter.
 10. An adapter, comprising: aprocessor and a memory; wherein, the memory is configured to storeexecutable program codes; and the processor is configured to run aprogram corresponding to the executable program codes by reading theexecutable program codes stored in the memory, so as to perform:receiving a set of n data blocks of first upgrade file transmitted by amobile terminal, wherein the first upgrade file is configured to upgradefirmware of the adapter, and the number n is a positive integer eitherless than or equal to a total number of data blocks of the first upgradefile; and transmitting first response information to the mobile terminalresponsive to receipt of the set of n data blocks, wherein the firstresponse information indicates whether the adapter has successfullyreceived the set of n data blocks.
 11. The adapter of claim 10, whereinthe processor is further configured to perform: determining thatupgrading the firmware of the adapter fails when the adapter has notreceived data blocks of the first upgrade file in a first preset timeinterval.
 12. The adapter of claim 10, wherein the processor is furtherconfigured to transmit the first response information to the mobileterminal responsive to receipt of the set of n data blocks by: when theadapter receives the ith data block of the set of n data blocks from themobile terminal, transmitting, by the adapter, the first responseinformation indicating that the adapter receives the ith data block ofthe first upgrade file to the mobile terminal, wherein the number i is apositive integer less than the number n.
 13. The adapter of claim 10,wherein the processor is further configured to perform: receiving firstindication information fed back from the mobile terminal, wherein thefirst indication information indicates that the first upgrade file hasbeen sent by the mobile terminal completely; transmitting a set of mdata blocks of second upgrade file to the mobile terminal, wherein thesecond upgrade file is the first upgrade file which is transmitted fromthe mobile terminal to the adapter, and the number m is a positiveinteger either less than or equal to a total number of data blocks ofthe second upgrade file; receiving second response information fed backfrom the mobile terminal responsive to the transmission of the set of mdata blocks; and determining that upgrading the firmware of the adapterfails if the second response information fed back from the mobileterminal indicates that the mobile terminal fails to receive all of theset of n data blocks.
 14. The adapter of claim 13, wherein the processoris further configured to perform: determining that upgrading thefirmware of the adapter fails when the adapter transmits the set of mdata blocks to the mobile terminal in a second preset time interval andthe adapter fails to receive the second response information.
 15. Theadapter of claim 13, wherein the second response information indicatesthat the mobile terminal has successfully received the set of m datablocks, and the processor is configured to: when the second upgrade filecomprises remaining data blocks, continuously sending the remaining datablocks of the second upgrade file by the adapter to the mobile terminal;and when the second upgrade file has been completely sent by theadapter, transmitting second indication information by the adapter tothe mobile terminal, wherein the second indication information indicatesthat the adapter has completely sent the second upgrade file.
 16. Theadapter of claim 13, wherein the processor is configured to: receivingthird indication information transmitted by the mobile terminal based ona comparison of the first upgrade file and the second upgrade file,wherein the third indication information indicates that upgrading thefirmware of the adapter either fails or succeeds.
 17. The adapter of 10,wherein the processor is further configured to perform: cancelling thereceived data blocks of the first upgrade file when upgrading thefirmware of the adapter fails.
 18. The adapter of claim 10, wherein theprocessor is configured to perform: transmitting version information tothe mobile terminal before the first upgrade file transmitted by themobile terminal is received, wherein the version information indicates acurrent version of the adapter; and receiving upgrading indicationinformation fed back from the mobile terminal, wherein the upgradingindication information indicates a need to upgrade firmware of theadapter.
 19. A method for upgrading firmware of an adapter, comprising:transmitting, by a mobile terminal, a set of n data blocks of a firstupgrade file to the adapter, wherein the first upgrade file isconfigured to upgrade the firmware of the adapter, and the number n is apositive integer either less than or equal to a total number of datablocks of the first upgrade file; receiving, by the mobile terminal,first response information fed back from the adapter responsive to thedata block transmission, wherein the first response informationindicates whether the adapter has successfully received the set of ndata blocks; and determining, by the mobile terminal, whether upgradingthe firmware of the adapter fails or succeeds based on the firstresponse information fed back from the adapter.
 20. The method of claim19, further comprising: determining, by the mobile terminal, thatupgrading the firmware of the adapter fails when the mobile terminaldoes not receive the first response information in a first preset timeinterval.